<?php
/**
 * mongo删除数据
 * author:chrisxu
 * date:2011-05-22
 */
include_once( '../drivers/mongo.php' );
include_once( 'config.php' );
$collection = 'test';//删除哪个集合数据
$where = array( '' => '' );
$option = array();

//db connect
extract($db_mongo);
$dbObj = new myMongo($host, $user, $password);
$dbObj->selectDB($dbname);
$dbObj->selectCollection($collection);

//start time
list($usec, $sec)  =  explode( " ", microtime() );
$start_time = (float)$usec + (float)$sec;

$dbObj->delete($where, $option);

//end time
list($usec, $sec)  =  explode( " ", microtime() );
$end_time = (float)$usec + (float)$sec;

$time = ( $end_time - $start_time ) * 10000;

file_put_contents('logs/delete_mongo_'.$collection.'.log', "\n	$start_time	$end_time	".$time, FILE_APPEND);
?>